package com.example.blog.controller;

import com.example.blog.entity.Article;
import com.example.blog.entity.Category;
import com.example.blog.service.impl.CategoryServiceImpl;
import com.yc.common.vo.Result;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 刘扬新
 * @since 2023-06-27
 */
@RestController
@RequestMapping("/blog/category")
public class CategoryController {

    @Resource
    CategoryServiceImpl categoryService;

    @RequestMapping("getCategory")
    public Result getCategory(){
        List<Category> category = categoryService.getCategory();
        if (category != null){
            return Result.success("查找成功",category);
        }
        return Result.failure("查找失败");
    }
}
